package vista;
import java.awt.event.ActionListener;
import java.util.List;

import javax.swing.BorderFactory;

import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;

import javax.swing.WindowConstants;
import javax.swing.border.BevelBorder;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VentanaCargaCompra extends javax.swing.JFrame {
        private JComboBox jcmbCompraIngredientes;
        private JTextField jtxtCompraIngrediente;
        private JLabel jlblCompraIngrediente;
        private JButton jbtnSalir;
        private JTextField jtxtCodIngrediente;
        private JButton jbtnImagen;
        private JButton jbtnComptaIngrediente;

        /**
        * Auto-generated main method to display this JFrame
        */
        public static void main(String[] args) {
                SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                                VentanaCargaCompra inst = new VentanaCargaCompra();
                                inst.setLocationRelativeTo(null);
                                inst.setVisible(true);
                        }
                });
        }
        
        public VentanaCargaCompra() {
                super();
                initGUI();
        }
        
        private void initGUI() {
                try {
                        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
                        getContentPane().setLayout(null);
                        getContentPane().setBackground(new java.awt.Color(255,255,255));
                        this.setTitle("Compras: Actualizar  Existencia de Ingredientes");
                        {
                                ComboBoxModel jcmbCompraIngredientesModel = 
                                        new DefaultComboBoxModel(
                                                        new String[] { "", "Item Two" });
                                jcmbCompraIngredientes = new JComboBox();
                                getContentPane().add(jcmbCompraIngredientes);
                                //jcmbCompraIngredientes.setModel(jcmbCompraIngredientesModel);
                                jcmbCompraIngredientes.setBounds(237, 18, 184, 21);
                        }
                        {
                                jbtnComptaIngrediente = new JButton();
                                getContentPane().add(jbtnComptaIngrediente);
                                jbtnComptaIngrediente.setText("Actualizar Inventario");
                                jbtnComptaIngrediente.setBounds(254, 119, 149, 21);
                                jbtnComptaIngrediente.setBackground(new java.awt.Color(82,209,232));
                        }
                        {
                                jtxtCompraIngrediente = new JTextField();
                                getContentPane().add(jtxtCompraIngrediente);
                                jtxtCompraIngrediente.setText("00");
                                jtxtCompraIngrediente.setBounds(291, 86, 69, 21);
                        }
                        {
                                jlblCompraIngrediente = new JLabel();
                                getContentPane().add(jlblCompraIngrediente);
                                jlblCompraIngrediente.setText("Cantidad Comprada:");
                                jlblCompraIngrediente.setBounds(254, 66, 149, 14);
                        }
                        {
                                jbtnImagen = new JButton();
                                jbtnImagen.setIcon(new ImageIcon(getClass().getClassLoader().getResource("imagen.jpg")));
                                getContentPane().add(jbtnImagen);
                                jbtnImagen.setBounds(18, 18, 193, 158);
                                jbtnImagen.setBackground(new java.awt.Color(82,209,232));
                                jbtnImagen.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
                        }
                        {
                                jtxtCodIngrediente = new JTextField();
                                getContentPane().add(jtxtCodIngrediente);
                                jtxtCodIngrediente.setBounds(249, 176, 33, 21);
                                jtxtCodIngrediente.setVisible(false);
                                jtxtCodIngrediente.setEditable(false);
                        }
                        {
                        	jbtnSalir = new JButton();
                        	getContentPane().add(jbtnSalir);
                        	jbtnSalir.setText("Salir");
                        	jbtnSalir.setBounds(291, 155, 69, 21);
                        	jbtnSalir.setBackground(new java.awt.Color(82,209,232));
                        }
                        pack();
                        this.setSize(461, 240);
                } catch (Exception e) {
                    //add your error handling code here
                        e.printStackTrace();
                }
                
        }
        
        public void addListener(ActionListener actionListener) {
                this.jbtnComptaIngrediente.addActionListener(actionListener);
                this.jbtnImagen.addActionListener(actionListener);
                this.jcmbCompraIngredientes.addActionListener(actionListener);
                this.jbtnSalir.addActionListener(actionListener);
        }
        
        public void setcargarComboIngredientes(List ingredientes) {
        ComboBoxModel jcmbCategoriaOrdenModelModel =
            new DefaultComboBoxModel(ingredientes.toArray());
        jcmbCompraIngredientes.setModel(jcmbCategoriaOrdenModelModel);
        }

        public String getJcmbCompraIngredientes() {
                return jcmbCompraIngredientes.getSelectedItem().toString();
        }

        public String getCantComprada() {
                return jtxtCompraIngrediente.getText();
        }

        public void setJtxtCompraIngrediente(String jtxtCompraIngrediente) {
                this.jtxtCompraIngrediente.setText(jtxtCompraIngrediente);
        }

        public String getCodIngrediente() {
                return jtxtCodIngrediente.getText();
        }

        public void setJtxtCodIngrediente(String jtxtCodIngrediente) {
                this.jtxtCodIngrediente.setText(jtxtCodIngrediente);
        }
 
		public void mostrarMensaje(String mensaje) {
            JOptionPane.showMessageDialog(this, mensaje);
    }
}
